using Bulb.Core.Services.DataStore;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Bulb.Test.RepositoryTests
{
    [TestClass]
    public class AddTests
        : RepositoryTests
    {
        [TestMethod]
        public void TestThatAddAddsBulbToRepository()
        {
            Assert.AreEqual(3, MockBulbItemRepository.All().Count);

            MockBulbItemRepository.Add(new BulbItem{ Name = "New bulb", Description = "Description"});

            Assert.AreEqual(4, MockBulbItemRepository.All().Count);

            var testProduct = MockBulbItemRepository.Filter(f => f.Name == "New bulb");

            Assert.IsNotNull(testProduct);
            Assert.IsInstanceOfType(testProduct[0], typeof(BulbItem));
            Assert.AreEqual(4, testProduct[0].Id);
        }
    }
}